Skip to content

Conversation

@greschd
Copy link
Member

@greschd greschd commented Nov 26, 2025

Implement gRPC transport option handling for the product launcher:

  • Add dataclasses to encapsulate the transport options for each transport mode,
    with a method to instantiate the corresponding gRPC channel
  • Modify the launcher interface: for gRPC servers, the launcher must now provide
    an entry in the newly added transport_options property, instead of providing
    an entry in the urls property.
    This change is needed since the URL itself is not sufficient to create a gRPC
    channel.
  • Adapt the test and server + launcher to use UDS.

Other changes:

  • rename the plugin entry point to ansys.tools.common.launcher

@github-actions github-actions bot added documentation Improvements or additions to documentation maintenance Package and maintenance related enhancement New features or code improvements labels Nov 26, 2025
@greschd greschd force-pushed the feat/launcher-grpc-transport-options branch from 0f9f7eb to 52aa7f8 Compare November 26, 2025 16:45
@@ -0,0 +1,179 @@
# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be worth discussing if this should be located here, or together with the cyberchannel module.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach to be honest. Maybe we should move it there eventually and adapt the cyberchannel function calls to use these options directly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's open an issue and start discussing it.

@greschd greschd marked this pull request as ready for review November 27, 2025 14:54
@greschd greschd requested a review from a team as a code owner November 27, 2025 14:54
Parameters
----------
timeout : float, default: None
timeout :
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here (and elsewhere) I incidentally reverted the edit to add the type. However, I'm unsure if we need to duplicate the content from the type hint: can we inject it at doc build time instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me - I think if there is a typehint and the Sphinx can infer it from there, it's okay. I'm worried about what LSPs in IDEs like VSC do. I don't know if when hovering/autocompleting, the docstring would show the proper type

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc rendering worked correctly in the ansys-tools-product-launcher repo (see here), but not with the AutoAPI setup used here (I tried following https://sphinx-autoapi.readthedocs.io/en/latest/how_to.html).

Do you happen to know a working setup for AutoAPI + Ansys Sphinx Theme + type hints rendered in the description?

Also (side note), the doc build is complaining about duplicate descriptions due to the reimport in the abstractions module; not sure exactly why that is (I didn't investigate further), but that should probably also be addressed.

Copy link
Member

@RobPasMue RobPasMue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking good - I guess this will require a new minor right?

@@ -0,0 +1,179 @@
# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach to be honest. Maybe we should move it there eventually and adapt the cyberchannel function calls to use these options directly.

@@ -0,0 +1,179 @@
# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's open an issue and start discussing it.

Parameters
----------
timeout : float, default: None
timeout :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me - I think if there is a typehint and the Sphinx can infer it from there, it's okay. I'm worried about what LSPs in IDEs like VSC do. I don't know if when hovering/autocompleting, the docstring would show the proper type

@greschd
Copy link
Member Author

greschd commented Nov 27, 2025

I guess this will require a new minor right

Yes. I'll want to actually try using it in PyACP (currently uses the old module still) before we release, though.

@greschd greschd force-pushed the feat/launcher-grpc-transport-options branch from 42d01f7 to 2f8e4c0 Compare November 27, 2025 22:01

LAUNCHER_ENTRY_POINT = "ansys.tools.local_product_launcher.launcher"
LAUNCHER_ENTRY_POINT = "ansys.tools.common.launcher"
DEPRECATED_LAUNCHER_ENTRY_POINT = "ansys.tools.local_product_launcher.launcher"
Copy link
Member Author

@greschd greschd Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, the ansys-launcher command may refer to either the version from ansys-tools-common, or the one from ansys-tools-local-product-launcher, depending on which package was installed last.

That's unavoidable since we want to reuse the ansys-launcher name, but we can ease the transition by initially accepting both entry points. Then we can upgrade with the following steps (in relatively short succession):

  • initial state: plugins use the old entry point
  • deprecate ansys-tools-local-product-launcher:
    • it only re-exports the objects from ansys-tools-common
    • remove its script entrypoint
  • plugins switch to the new entry point
  • (some time later) remove the DEPRECATED_LAUNCHER_ENTRY_POINT handling here

@greschd
Copy link
Member Author

greschd commented Nov 27, 2025

@RobPasMue what's the rationale behind creating our own exception hierarchy (specifically, the use of ProductInstanceError where it was a plain RuntimeError before) rather than using the built-in exceptions?
This is causing some problems in PyACP since I'm now catching the wrong exception type. It also means the uncaught exceptions will change type, which is technically a backwards-incompatible change to PyACP.

As such, I'm trying to figure out if PyACP should go the same route, or spend extra effort to hide this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New features or code improvements maintenance Package and maintenance related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants